<extend name="Layout/ins_page" />
<block name="content">
	{:W('PageHeader/simple',array('name'=>'类别新建'))}
	<div class="space-8"></div>
	<if condition="$auth['write']">
		<div class="operate panel panel-default">
			<div class="panel-body">
				<div class="pull-right">
					<a class="btn btn-sm btn-primary" href="{:U('addProductType')}">新建</a>
				</div>
			</div>
		</div>
	</if>
	<div class="ul_table">
		<ul>
			<li class="thead">
				<span class="col-10">类别名称</span>
				<span class="col-10 text-center">编辑</span>
			</li>
			<empty name="list">
				<li class="no-data">
					没找到数据
				</li>
				<else/>
				<foreach name="list" item="vo">
					<li class="tbody">
						<span class="col-10 ">{$vo.type_name}</span>
						<span class="col-10 text-center">
							<if condition="$auth['write']">
								<a href="{:U('editType','id='.$vo['id'])}">编辑</a>&nbsp;
								<a onclick="deleteType({$vo['id']});">删除</a>
						    </if>
						</span>
					</li>
				</foreach>
				<div class="pagination">
					{$page}
				</div>
			</empty>
		</ul>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function deleteType(id)	{
			ui_confirm('确定删除库存类别吗', function() {
				sendAjax("{:U('deleteType')}",'id='+id, function(data) {
					if (data.status) {
						location.reload(true);
					} else {
						ui_error(data.info);
					}
				});	
			});
		}
	</script>
</block>